#include <QtGui/QApplication>
#include <MComponentData>
#include <QtDeclarative>
#include <QGraphicsItem>
#include "qmlapplicationviewer.h"
#include "mediakeys.h"
#include "gconfitemqmlproxy.h"

Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QScopedPointer<QApplication> app(createApplication(argc, argv));
    MComponentData::createInstance(argc, argv);

    MediaKeys controller;

    qmlRegisterType<GConfItemQmlProxy>("MeeGoSettings", 1, 0, "GConfItem");

    QmlApplicationViewer viewer;
    viewer.setMainQmlFile(QLatin1String("qml/mediakeys/main.qml"));
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);
    viewer.showExpanded();

    QObject *root = viewer.rootObject();
    controller.setGconfUpAction(   root->findChild<GConfItemQmlProxy*>(QString("volumeup"))   );
    controller.setGconfDownAction( root->findChild<GConfItemQmlProxy*>(QString("volumedown")) );
    controller.setGconfStatus(     root->findChild<GConfItemQmlProxy*>(QString("enabled"))    );
    controller.setGconfLongPress(  root->findChild<GConfItemQmlProxy*>(QString("longpress"))  );
    controller.setGconfPressDuration( root->findChild<GConfItemQmlProxy*>(QString("longpressduration")) );

    return app->exec();
}
